
<!-- body onload="document.registration.userid.focus();"-->
<%@page contentType="text/html" pageEncoding="UTF-8"%>
<%@taglib prefix="t" tagdir="/WEB-INF/tags"%>

<%@ taglib prefix="c" uri="http://java.sun.com/jsp/jstl/core"%>
<%@ taglib uri="http://java.sun.com/jsp/jstl/functions" prefix="fn"%>
<%@taglib prefix="error" uri="/WEB-INF/tags/ErrorTag.tld"%>
<%@taglib prefix="user" uri="/WEB-INF/tags/UserDescriptor.tld"%>


<t:basicTemplate pageTitle="SWIMv2 - Normal Search">
	<jsp:attribute name="extrahead">
		<link rel='stylesheet' href='css/search.css' type='text/css' />

		   <!-- toggle from advanced to normal  or vice versa  -->
		   <script type="text/javascript" src="script/toggle.js"></script>	
	</jsp:attribute>

	<jsp:body>
		<h1>Search users</h1>
		
		<div class="error-style">
			<error:errors error="${param.error}"></error:errors>
		</div>
		
		<div id="image_and_form">
			<div id="fletcher">
				<img src="img/fletcher_search.jpg" alt="fletcher is gonna find out"
					id="fletcher" />
			</div>
			<div id="changelink">
				<a href="#" id="change_form">Pass To Advanced Search</a>
			</div>
			<div id="form">
				
		 		<div id="campi_min">   	
					<!-- research  -->
					<%@include file="SearchForm.jsp"%>
				</div> <!--   div campi min -->
	   		
	
	   			<div id="campi_esosi">
	 					<form id="advancedSearchbox" name="advanced_search" method="post"
						action="./proceedAdvancedSearch" id="search_ad_form">
	 					<ul>
								<li><label for="name">Name:</label> </li>
								<li><input type="text" value="" name="name" /> </li>
									
								<li><label for="surname">Surname:</label></li>
								<li><input type="text" value="" name="surname" /> </li>  
									
								<li><label for="ability">Ability:</label>  </li>
								<li><input type="text" value="" name="ability" /> </li> 
									
								<li><label for="email">Email:</label>  </li>
								<li><input type="text" value="" name="email" /> </li>   
								
								<li><label for="city">City:</label>  </li>
								<li><input type="text" value="" name="city" /> </li>   
								
								<li><input id="advancedsearch_button" type="submit"
								name="submit" value="Search!" /> </li>
						 </ul>
		    	 </form>
		
	   			</div> <!--  div campi esosi -->
	   		</div>
			<!--  div id = form -->
   		
	
		<div id="results">
		
			<h2>Goood Morning !</h2>
			
			<c:if test="${fn:length(userResultMap) > 0}">
				
				<c:forEach items="${userResultMap}" var="map">
					 <br />

					 	<div id="userDisplay">		 	 
						 	 <user:display username="${map['username']}"
								surname="${map['surname']}" name="${map['name']}"
								email="${map['email']}" category="${map['category']}"
								image="${map['image']}"
								ability="${map['matched_ability']}"
								 />
					 	</div>				 
						<br /> <br />
				</c:forEach>
			</c:if>
		
		</div>

		
		<c:if test="${fn:length(userResultMap) == 0}">
			
			<c:if test="${(not empty param.query)}">
				<h2>  Mss. Fletcher did not found any result, the user is probably death </h2>
			</c:if>
		</c:if>
		
	</div>

	
	</jsp:body>
</t:basicTemplate>





